package mxw.suiye.autopydroid.util;

import android.os.Handler;


/**安卓Handler对象管理**/
public class MyHandler {

    private static Handler appHandle;
    private static Handler accessibilityHandler;



    public static void setAppHandle(Handler.Callback callback) {
        MyHandler.appHandle = new Handler(callback);
    }

    public static void setAccessibilityHandler(Handler.Callback callback) {
        MyHandler.accessibilityHandler = new Handler(callback);
    }

    public static void nullAccessibility(){
        MyHandler.accessibilityHandler = null;
    }

    public static void closeAccessibility(){
        if (accessibilityStatus()) {
            accessibilityHandler.sendEmptyMessage(-1);
        }
    }

    public static void closeAppHandle(){
        appHandle.sendEmptyMessage(0);
    }

    public static Handler getAppHandle() {
        return appHandle;
    }


    public static Handler getAccessibilityHandler() {
        return accessibilityHandler;
    }

    //查看辅助状态
    public static boolean accessibilityStatus() {
        return accessibilityHandler!= null;
    }

}
